# 你想读取一个XML 文档，对它最一些修改，然后将结果写回XML 文档。

from xml.etree.ElementTree import parse, Element
doc = parse('rss20.xml')
root = doc.getroot()
print(root)

channel = root.find('channel')
print(channel.getchildren().index(channel.find('description')))
channel.remove(channel.find('language'))
print(channel.getchildren().index(channel.find('description')))

e = Element('new_tag')
e.text = 'en'
channel.insert(2, e)

# 写回文件
doc.write('newrss20.xml', xml_declaration=True)
